3.208 \(\int \cot ^2(e+f x) (a+b \tan ^2(e+f x))^2 \, dx\)

Optimal. Leaf size=38 \[ -\frac{a^2 \cot (e+f x)}{f}-x (a-b)^2+\frac{b^2 \tan (e+f x)}{f} \]

[Out]

-((a - b)^2*x) - (a^2*Cot[e + f*x])/f + (b^2*Tan[e + f*x])/f

________________________________________________________________________________________

Rubi [A]  time = 0.06506, antiderivative size = 38, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.13, Rules used = {3670, 461, 203} \[ -\frac{a^2 \cot (e+f x)}{f}-x (a-b)^2+\frac{b^2 \tan (e+f x)}{f} \]

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]^2*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-((a - b)^2*x) - (a^2*Cot[e + f*x])/f + (b^2*Tan[e + f*x])/f

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rule 461

Int[(((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_))/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Int[ExpandIntegr
and[((e*x)^m*(a + b*x^n)^p)/(c + d*x^n), x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[n
, 0] && IGtQ[p, 0] && (IntegerQ[m] || IGtQ[2*(m + 1), 0] ||  !RationalQ[m])

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \cot ^2(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{\left (a+b x^2\right )^2}{x^2 \left (1+x^2\right )} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{\operatorname{Subst}\left (\int \left (b^2+\frac{a^2}{x^2}-\frac{(a-b)^2}{1+x^2}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{a^2 \cot (e+f x)}{f}+\frac{b^2 \tan (e+f x)}{f}-\frac{(a-b)^2 \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-(a-b)^2 x-\frac{a^2 \cot (e+f x)}{f}+\frac{b^2 \tan (e+f x)}{f}\\ \end{align*}

Mathematica [C]  time = 0.102656, size = 66, normalized size = 1.74 \[ -\frac{a^2 \cot (e+f x) \text{Hypergeometric2F1}\left (-\frac{1}{2},1,\frac{1}{2},-\tan ^2(e+f x)\right )}{f}+2 a b x-\frac{b^2 \tan ^{-1}(\tan (e+f x))}{f}+\frac{b^2 \tan (e+f x)}{f} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]^2*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

2*a*b*x - (b^2*ArcTan[Tan[e + f*x]])/f - (a^2*Cot[e + f*x]*Hypergeometric2F1[-1/2, 1, 1/2, -Tan[e + f*x]^2])/f
 + (b^2*Tan[e + f*x])/f

________________________________________________________________________________________

Maple [A]  time = 0.04, size = 53, normalized size = 1.4 \begin{align*}{\frac{{b}^{2} \left ( \tan \left ( fx+e \right ) -fx-e \right ) +2\, \left ( fx+e \right ) ab+{a}^{2} \left ( -\cot \left ( fx+e \right ) -fx-e \right ) }{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)^2*(a+b*tan(f*x+e)^2)^2,x)

[Out]

1/f*(b^2*(tan(f*x+e)-f*x-e)+2*(f*x+e)*a*b+a^2*(-cot(f*x+e)-f*x-e))

________________________________________________________________________________________

Maxima [A]  time = 1.64509, size = 62, normalized size = 1.63 \begin{align*} \frac{b^{2} \tan \left (f x + e\right ) -{\left (a^{2} - 2 \, a b + b^{2}\right )}{\left (f x + e\right )} - \frac{a^{2}}{\tan \left (f x + e\right )}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

(b^2*tan(f*x + e) - (a^2 - 2*a*b + b^2)*(f*x + e) - a^2/tan(f*x + e))/f

________________________________________________________________________________________

Fricas [A]  time = 1.04018, size = 115, normalized size = 3.03 \begin{align*} -\frac{{\left (a^{2} - 2 \, a b + b^{2}\right )} f x \tan \left (f x + e\right ) - b^{2} \tan \left (f x + e\right )^{2} + a^{2}}{f \tan \left (f x + e\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

-((a^2 - 2*a*b + b^2)*f*x*tan(f*x + e) - b^2*tan(f*x + e)^2 + a^2)/(f*tan(f*x + e))

________________________________________________________________________________________

Sympy [A]  time = 5.50577, size = 73, normalized size = 1.92 \begin{align*} \begin{cases} \tilde{\infty } a^{2} x & \text{for}\: \left (e = 0 \vee e = - f x\right ) \wedge \left (e = - f x \vee f = 0\right ) \\x \left (a + b \tan ^{2}{\left (e \right )}\right )^{2} \cot ^{2}{\left (e \right )} & \text{for}\: f = 0 \\- a^{2} x - \frac{a^{2}}{f \tan{\left (e + f x \right )}} + 2 a b x - b^{2} x + \frac{b^{2} \tan{\left (e + f x \right )}}{f} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)**2*(a+b*tan(f*x+e)**2)**2,x)

[Out]

Piecewise((zoo*a**2*x, (Eq(e, 0) | Eq(e, -f*x)) & (Eq(f, 0) | Eq(e, -f*x))), (x*(a + b*tan(e)**2)**2*cot(e)**2
, Eq(f, 0)), (-a**2*x - a**2/(f*tan(e + f*x)) + 2*a*b*x - b**2*x + b**2*tan(e + f*x)/f, True))

________________________________________________________________________________________

Giac [A]  time = 1.6694, size = 66, normalized size = 1.74 \begin{align*} \frac{b^{2} \tan \left (f x + e\right ) -{\left (a^{2} - 2 \, a b + b^{2}\right )}{\left (f x + e\right )} - \frac{a^{2}}{\tan \left (f x + e\right )}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

(b^2*tan(f*x + e) - (a^2 - 2*a*b + b^2)*(f*x + e) - a^2/tan(f*x + e))/f